<template>
  <div class="app-container">
    <Ht-search-form
      v-show="showSearch"
      :advOptions="[]"
      :dictMap="dictMap"
      :formOptions="formOptions"
      :outputQueryParams="queryParams"
      :queryParams="queryParams"
      :defaultEventKey="defaultEventKey"
      :labelWidth="80"
    ></Ht-search-form>

    <ht-table
      ref="dataTable"
      :dictMap="dictMap"
      :multi-select="false"
      :opButtonList="opButtonList"
      :queryParams="queryParams"
      :reqConfig="regConfig"
      :showSerialNumber="false"
      :tableBindColumns="tableBindColumns"
      :defaultEventKey="defaultEventKey"
    >
      <template v-slot:operate>
        <el-table-column align="left" fixed="right" label="操作" width="50">
          <template slot-scope="scope">
            <ht-button-group
              :buttonList="[
                {
                  label: '明细',
                  doFunc: () => {
                    handleAction('detail', scope.row);
                  },
                },
              ]"
            />
          </template>
        </el-table-column>
      </template>
    </ht-table>

    <el-dialog
      :close-on-click-modal="false"
      :title="title"
      center
      :visible.sync="open"
      v-if="open"
      append-to-body
      width="1024px"
    >
      <el-form ref="detailForm" :model="detailForm" :rules="rules" label-width="120px">
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="交易流水号" prop="id">
              <el-input v-model="detailForm.id" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="工作日期" prop="workdate">
              <el-date-picker
                v-model="detailForm.workdate"
                style="width: 100%"
                type="date"
                value-format="yyyyMMdd"
                :disabled="true"
              />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="CPG日期" prop="vdate">
              <el-date-picker
                v-model="detailForm.vdate"
                style="width: 100%"
                type="date"
                value-format="yyyyMMdd"
                :disabled="true"
              />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="原报文类型" prop="pkgNo">
              <el-select
                style="width: 100%"
                v-model="
                  detailForm.pkgNo === null || detailForm.pkgNo === undefined
                    ? ''
                    : detailForm.pkgNo + '-' + detailForm.pkgNoDesc
                "
                placeholder="原报文类型"
                :disabled="true"
              ></el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="原报文标识号" prop="pkgId">
              <el-input v-model="detailForm.pkgId" disabled />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="原发起方" prop="indirectSender">
              <el-input v-model="detailForm.indirectSender" :disabled="true" />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="原发起方名称" prop="indirectSendername">
              <el-input v-model="detailForm.indirectSendername" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="原业务类型" prop="bizType">
              <el-select
                style="width: 100%"
                v-model="
                  detailForm.bizType === null || detailForm.bizType === undefined
                    ? ''
                    : detailForm.bizType + '-' + detailForm.bizTypeDesc
                "
                placeholder="原业务类型"
                :disabled="true"
              ></el-select>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="原业务种类" prop="bizCtgy">
              <el-select
                style="width: 100%"
                v-model="
                  detailForm.bizCtgy === null || detailForm.bizCtgy === undefined
                    ? ''
                    : detailForm.bizCtgy + '-' + detailForm.bizCtgyDesc
                "
                placeholder="原业务种类"
                :disabled="true"
              ></el-select>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="原信息标题" prop="msgTitle">
              <el-input v-model="detailForm.msgTitle" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="24">
            <el-form-item label="原信息内容" prop="msgContent">
              <el-input type="textarea" v-model="detailForm.msgContent" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="原附件长度" prop="attchmtLength">
              <el-input v-model="detailForm.attchmtLength" :disabled="true" />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="原附件名称" prop="attchmtName">
              <el-input v-model="detailForm.attchmtName" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="回执结果" prop="bizStatus">
              <el-select style="width: 100%" v-model="detailForm.bizStatus" placeholder="回执结果" disabled>
                <el-option
                  v-for="dict in dictMap.BIZ_REJECT_CODE_310_312"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="回执拒绝处理码" prop="bizRejectCode">
              <el-select style="width: 100%;"
                         v-model="detailForm.bizRejectCode===null||detailForm.bizRejectCode===undefined?'':detailForm.bizRejectCode+'-'+detailForm.bizRejectCodeDesc"
                         placeholder="回执拒绝处理码" :disabled="true"
              >

              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex">
          <el-col :span="24">
            <el-form-item label="回执拒绝信息" prop="bizRejectInfo">
              <el-input type="textarea" v-model="detailForm.bizRejectInfo" disabled/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="回执附件长度" prop="attchmtLength1">
              <el-input v-model="detailForm.attchmtLength1" :disabled="true" />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="回执附件名称" prop="attchmtName1">
              <el-input v-model="detailForm.attchmtName1" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="业务处理参与机构" prop="bizProOrg">
              <el-input v-model="detailForm.bizProOrg" :disabled="true" />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="业务处理参与机构名称" prop="bizProOrgname">
              <el-input v-model="detailForm.bizProOrgname" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="24">
            <el-form-item label="附言" prop="remarks">
              <el-input type="textarea" v-model="detailForm.remarks" disabled />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12">
            <el-form-item label="录入操作员：" prop="mdTlrno">
              <el-input v-model="detailForm.mdTlrno" placeholder="" disabled/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="录入时间：" prop="mdTime">
              <el-date-picker
                v-model="detailForm.mdTime"
                type="datetime"
                value-format="yyyyMMddHHmmss"
                placeholder=""
                style="width: 100%"
                disabled
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="24">
            <el-form-item label="审核附言" prop="audRemarks">
              <el-input type="textarea" v-model="detailForm.audRemarks"  maxlength="128" show-word-limit/>
            </el-form-item>
          </el-col>
        </el-row>


        <div
          v-if="
            this.detailForm.bizType === 'M505' ||
            this.detailForm.bizCtgy === '06807' ||
            this.detailForm.bizCtgy === '06804' ||
            this.detailForm.bizCtgy === '068014' ||
            this.detailForm.bizCtgy === '068015' ||
            this.detailForm.bizCtgy === '068016'
          "
        >
          <el-card class="form-card txnInfo-card">
            <div slot="header" class="label-header-msg">
              <span>313附件信息</span>
            </div>

            <el-row type="flex">
              <el-col :span="12">
                <el-form-item label="地域标识" prop="regionid">
                  <el-select
                    style="width: 100%"
                    v-model="detailForm.regionid"
                    placeholder="地域标识"
                    :disabled="true"
                  >
                    <el-option
                      v-for="dict in dictMap.RegionId"
                      :key="dict.value"
                      :label="`${dict.value}-${dict.text}`"
                      :value="dict.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>

              <el-col :span="12">
                <el-form-item label="统一社会信用代码" prop="uniformScCode">
                  <el-input v-model="detailForm.uniformScCode" :disabled="true" />
                </el-form-item>
              </el-col>
            </el-row>
          </el-card>
        </div>

        <div v-if="this.detailForm.bizType === 'M505' && this.detailForm.bizCtgy === '06804'">
          <el-card class="form-card txnInfo-card">
            <div slot="header" class="label-header-msg">
              <span>账户信息核验查询</span>
            </div>
            <el-row type="flex">
              <el-col :span="12">
                <el-form-item label="查询类型" prop="quryType">
                  <el-select style="width: 100%" v-model="detailForm.quryType" placeholder="查询类型" :disabled="true">
                    <el-option
                      v-for="dict in dictMap.QURY_TYPE_312"
                      :key="dict.value"
                      :label="`${dict.value}-${dict.text}`"
                      :value="dict.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="查询账户数目" prop="acctCnt">
                  <el-input v-model="detailForm.acctCnt" :disabled="true" />
                </el-form-item>
              </el-col>
            </el-row>

            <ht-table
              ref="dataTable"
              :dictMap="dictMap"
              :multi-select="false"
              :opButtonList="opButtonList"
              :queryParams="queryDetailParams"
              :reqConfig="regConfig06804"
              :showSerialNumber="false"
              :tableBindColumns="tableBindColumns06804"
            >
              <template v-slot:operate>
                <el-table-column align="left" fixed="right" label="操作" width="50">
                  <template slot-scope="scope">
                    <ht-button-group
                      :buttonList="[
                        {
                          label: '应答',
                          doFunc: () => {
                            handleAction('detail06804', scope.row);
                          },
                        },
                      ]"
                    />
                  </template>
                </el-table-column>
              </template>
            </ht-table>
          </el-card>
        </div>
        <div v-if="this.detailForm.bizType === 'M505' && this.detailForm.bizCtgy === '06814'">
          <el-card class="form-card txnInfo-card">
            <div slot="header" class="label-header-msg">
              <span>存量协议信息通知</span>
            </div>

            <el-row type="flex">
              <el-col :span="12">
                <el-form-item label="客户号" prop="custId">
                  <el-input v-model="detailForm.custId" :disabled="true" />
                </el-form-item>
              </el-col>

              <el-col :span="12">
                <el-form-item label="入网机构标识号" prop="accsPtyId">
                  <el-input v-model="detailForm.accsPtyId" :disabled="true" />
                </el-form-item>
              </el-col>
            </el-row>

            <el-row type="flex">
              <el-col :span="12">
                <el-form-item label="费项数目" prop="paymentNum">
                  <el-input v-model="detailForm.paymentNum" :disabled="true" />
                </el-form-item>
              </el-col>
            </el-row>

            <el-row type="flex">
              <el-col :span="24">
                <el-form-item label="备注" prop="remarks13">
                  <el-input type="textarea" v-model="detailForm.remarks13" :disabled="true" />
                </el-form-item>
              </el-col>
            </el-row>
          </el-card>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="协议号" prop="protoId">
                <el-input v-model="detailForm.protoId" :disabled="true" />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="开户行行号" prop="accBrno">
                <el-input v-model="detailForm.accBrno" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="客户名称" prop="custName">
                <el-input v-model="detailForm.custName" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="账户类型" prop="actnoType">
                <el-select
                  style="width: 100%"
                  v-model="detailForm.actnoType"
                  placeholder="账户类型"
                  :disabled="true"
                >
                  <el-option
                    v-for="dict in dictMap.CustomerAccountTypeCode"
                    :key="dict.value"
                    :label="`${dict.value}-${dict.text}`"
                    :value="dict.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="账号/卡号" prop="payerActno">
                <el-input v-model="detailForm.payerActno" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="一次扣费限额币种" prop="limitCurcd">
                <el-input v-model="detailForm.limitCurcd" :disabled="true" />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="一次扣费限额" prop="limitAmt">
                <el-input v-model="detailForm.limitAmt" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="协议到期日期" prop="contDueDate">
                <el-date-picker
                  v-model="detailForm.contDueDate"
                  style="width: 100%"
                  type="date"
                  value-format="yyyyMMdd"
                  :disabled="true"
                />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="协议签署日期" prop="contSignDate">
                <el-date-picker
                  v-model="detailForm.contSignDate"
                  style="width: 100%"
                  type="date"
                  value-format="yyyyMMdd"
                  :disabled="true"
                />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="生效日期" prop="effectDate">
                <el-date-picker
                  v-model="detailForm.effectDate"
                  style="width: 100%"
                  type="date"
                  value-format="yyyyMMdd"
                  :disabled="true"
                />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="授权模式" prop="authModel">
                <el-select
                  style="width: 100%"
                  v-model="detailForm.authModel"
                  placeholder="授权模式"
                  :disabled="true"
                >
                  <el-option
                    v-for="dict in dictMap.AuthModelCode"
                    :key="dict.value"
                    :label="`${dict.value}-${dict.text}`"
                    :value="dict.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="缴费人名称" prop="payerName">
                <el-input v-model="detailForm.payerName" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="缴费人证件类型" prop="payerIdType">
                <el-select
                  style="width: 100%"
                  v-model="detailForm.payerIdType"
                  placeholder="缴费人证件类型"
                  :disabled="true"
                >
                  <el-option
                    v-for="dict in dictMap.Id_Type_Code"
                    :key="dict.value"
                    :label="`${dict.value}-${dict.text}`"
                    :value="dict.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="缴费人证件号码" prop="payerIdNo">
                <el-input v-model="detailForm.payerIdNo" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="联系电话" prop="payerTel">
                <el-input v-model="detailForm.payerTel" :disabled="true" />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="地址" prop="payerAddr">
                <el-input v-model="detailForm.payerAddr" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="扣款时间单位" prop="timeUnit">
                <el-select
                  style="width: 100%"
                  v-model="detailForm.timeUnit"
                  placeholder="扣款时间单位"
                  :disabled="true"
                >
                  <el-option
                    v-for="dict in dictMap.TimeUnitCode"
                    :key="dict.value"
                    :label="`${dict.value}-${dict.text}`"
                    :value="dict.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="扣款时间步长" prop="timeStep">
                <el-input v-model="detailForm.timeStep" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="24">
              <el-form-item label="扣款时间描述" prop="timeDesc">
                <el-input type="textarea" v-model="detailForm.timeDesc" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="扣款周期内限制笔数" prop="cycLimitNum">
                <el-input v-model="detailForm.cycLimitNum" :disabled="true" />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="扣款周期内扣费限额币种" prop="cycLimitCurcd">
                <el-input v-model="detailForm.cycLimitCurcd" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="扣款周期内扣费限额" prop="amount">
                <ht-amount-input v-model="detailForm.amount" placeholder="金额" :disable="true"></ht-amount-input>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="协议状态" prop="contStatus">
                <el-select
                  style="width: 100%"
                  v-model="detailForm.contStatus"
                  placeholder="协议状态"
                  :disabled="true"
                >
                  <el-option
                    v-for="dict in dictMap.ContractStatusCode"
                    :key="dict.value"
                    :label="`${dict.value}-${dict.text}`"
                    :value="dict.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="协议导入日期" prop="impContDate" :disabled="true">
                <el-date-picker
                  v-model="detailForm.impContDate"
                  style="width: 100%"
                  type="date"
                  value-format="yyyyMMdd"
                />
              </el-form-item>
            </el-col>
          </el-row>

          <ht-table
            ref="dataTable"
            :dictMap="dictMap"
            :multi-select="false"
            :opButtonList="opButtonList"
            :queryParams="queryDetailParams"
            :reqConfig="regConfig06813"
            :showSerialNumber="false"
            :tableBindColumns="tableBindColumns06813"
          ></ht-table>
        </div>
        <div v-if="this.detailForm.bizType === 'M505' && this.detailForm.bizCtgy === '06815'">
          <el-card class="form-card txnInfo-card">
            <div slot="header" class="label-header-msg">
              <span>代收付中心入网机构信息</span>
            </div>

            <el-row type="flex">
              <el-col :span="12">
                <el-form-item label="信息类型" prop="infoType">
                  <el-select
                    style="width: 100%"
                    v-model="detailForm.infoType"
                    placeholder="信息类型"
                    :disabled="true"
                  >
                    <el-option
                      v-for="dict in dictMap.INFO_TYPE"
                      :key="dict.value"
                      :label="`${dict.value}-${dict.text}`"
                      :value="dict.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>

              <el-col :span="12">
                <el-form-item label="变更期数" prop="chngNum">
                  <el-input v-model="detailForm.chngNum" :disabled="true" />
                </el-form-item>
              </el-col>
            </el-row>

            <el-row type="flex">
              <el-col :span="24">
                <el-form-item label="备注" prop="remarks14">
                  <el-input type="textarea" v-model="detailForm.remarks14" :disabled="true" />
                </el-form-item>
              </el-col>
            </el-row>

            <ht-table
              ref="dataTable"
              :dictMap="dictMap"
              :multi-select="false"
              :opButtonList="opButtonList"
              :queryParams="queryDetailParams"
              :reqConfig="regConfig06814"
              :showSerialNumber="false"
              :tableBindColumns="tableBindColumns06814"
            >
              <template v-slot:operate>
                <el-table-column align="left" fixed="right" label="操作" width="50">
                  <template slot-scope="scope">
                    <ht-button-group
                      :buttonList="[
                        {
                          label: '明细',
                          doFunc: () => {
                            handleAction('detail06814', scope.row);
                          },
                        },
                      ]"
                    />
                  </template>
                </el-table-column>
              </template>
            </ht-table>
          </el-card>
        </div>
        <div v-if="this.detailForm.bizType === 'M505' && this.detailForm.bizCtgy === '06816'">
          <el-card class="form-card txnInfo-card">
            <div slot="header" class="label-header-msg">
              <span>入网机构和费项关系信息</span>
            </div>

            <el-row type="flex">
              <el-col :span="12">
                <el-form-item label="信息类型" prop="infoType">
                  <el-select
                    style="width: 100%"
                    v-model="detailForm.infoType"
                    placeholder="信息类型"
                    :disabled="true"
                  >
                    <el-option
                      v-for="dict in dictMap.INFO_TYPE"
                      :key="dict.value"
                      :label="`${dict.value}-${dict.text}`"
                      :value="dict.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>

              <el-col :span="12">
                <el-form-item label="变更期数" prop="chngNum">
                  <el-input v-model="detailForm.chngNum" :disabled="true" />
                </el-form-item>
              </el-col>
            </el-row>

            <el-row type="flex">
              <el-col :span="24">
                <el-form-item label="备注" prop="remarks15">
                  <el-input type="textarea" v-model="detailForm.remarks15" :disabled="true" />
                </el-form-item>
              </el-col>
            </el-row>

            <ht-table
              ref="dataTable"
              :dictMap="dictMap"
              :multi-select="false"
              :opButtonList="opButtonList"
              :queryParams="queryDetailParams"
              :reqConfig="regConfig06815"
              :showSerialNumber="false"
              :tableBindColumns="tableBindColumns06815"
            >
              <template v-slot:operate>
                <el-table-column align="left" fixed="right" label="操作" width="50">
                  <template slot-scope="scope">
                    <ht-button-group
                      :buttonList="[
                        {
                          label: '明细',
                          doFunc: () => {
                            handleAction('detail06815', scope.row);
                          },
                        },
                      ]"
                    />
                  </template>
                </el-table-column>
              </template>
            </ht-table>
          </el-card>
        </div>
      </el-form>

      <div slot="footer" align="center" class="dialog-footer">
        <el-button type="primary" @click="approve">审 核</el-button>
        <el-button type="primary" @click="reject">拒 绝</el-button>
        <el-button type="primary" v-if="detailForm.attchmtLength!=='0'"
                   @click="downloadFile(detailForm.attchmtContent,detailForm.attchmtName)">下载原报文附件</el-button>
        <el-button type="primary" v-if="detailForm.attchmtLength1!=='0' && detailForm.pkgNo!=='ccms.310.001.01'"
                   @click="downloadFile(detailForm.attchmtContent1,detailForm.attchmtName1)">下载应答录入附件</el-button>

        <el-button type="primary" @click="cancel">关 闭</el-button>
      </div>
    </el-dialog>

    <general-information-repsd-approve-detail
      ref="generalInformationRepsdApproveDetail"
      :dictMap="dictMap"
    ></general-information-repsd-approve-detail>

    <base-data-dialog ref="basedataDialog" @confirm="confirmData"></base-data-dialog>
  </div>
</template>

<script>
import {
  apiUrlConfiApprove,
  apiUrlConfiApprove06804,
  apiUrlConfiApprove06813,
  apiUrlConfiApprove06814,
  apiUrlConfiApprove06815,
  generalInformationRepsdAppDetail,
  generalInformationApproveApprove,
  generalInformationApproveReject,

} from "@/api/cnaps/ccms/311";
import { listPageMixin } from "@/libs/listPageMixin";
import HtAmountInput from "@/views/components/HtAmountInput";
import generalInformationRepsdApproveDetail from "./general_information_repsd_approve_detail";
import BaseDataDialog from "@/views/components/BasedataDialog";
import { getBasedata } from "@/api/cnaps/common/basedata";
import { baseUrlConfig, downloadfile } from "@/api/authority_app/base";

export default {
  name: "GeneralInformationRepsdApprove",
  mixins: [listPageMixin],
  components: { BaseDataDialog, HtAmountInput, generalInformationRepsdApproveDetail },
  data() {
    let self = this;
    return {
      defaultEventKey: "defaultEventKey",
      // 查询参数
      queryParams: {
        idSeqNo:'',
        workdate1:'',
        workdate2:'',
        mestype:'',
      },
      queryDetailParams: {},

      // 搜索
      formOptions: [],
      //
      searchFormDictList: [
        "PKG_310_312",
        "CustomerAccountTypeCode",
        "AuthModelCode",
        "Id_Type_Code",
        "TimeUnitCode",
        "INFO_TYPE",
        "RegionId",
        "CHANGECODE",
        "EFFECTIVECODE",
        "BIZ_REJECT_CODE_310_312",
        "QURY_TYPE_312",
        "ACCT_STATUS_312",
        "Vertifi_Result_Code",
        "ACCT_ATTRIBUTE_313",
        "BIZ_CTGY",
        "BIZ_TYPE",
        "BIZRT_STATUS"
      ],
      // 列信息
      regConfig: apiUrlConfiApprove,

      regConfig06804: apiUrlConfiApprove06804,

      regConfig06813: apiUrlConfiApprove06813,

      regConfig06814: apiUrlConfiApprove06814,

      regConfig06815: apiUrlConfiApprove06815,

      tableBindColumns: [
        { prop: "id", label: "交易流水号", width: 180 },
        { prop: "workdate", label: "工作日期", type: "date", width: 120 },
        { prop: "vdate", label: "CPG日期", type: "date", width: 120 },
        { prop: "msgtype", label: "原报文类型", dictCode: "PKG_310_312", width: 180 },
        {
          prop: "bizType",
          label: "原业务类型",
          dictCode: "BIZ_TYPE",
          width: 240,
        },
        {
          prop: "bizCtgy",
          label: "原业务种类",
          dictCode: "BIZ_CTGY",
          width: 240,
        },
        { prop: "bizStatus", label: "回执结果",dictCode:"BIZ_REJECT_CODE_310_312",width: 180 },
        { prop: "bizRejectCode", label: "业务拒绝处理码",width: 180 ,
          formatter(row, text, index) {
            return (
              (row["bizRejectCode"] === null || row["bizRejectCode"] === undefined ? "" : row["bizRejectCode"]) +
              "-" +
              (row["bizRejectCodeDesc"] === null || row["bizRejectCodeDesc"] === undefined
                ? ""
                : row["bizRejectCodeDesc"])
            );
          }},
        { prop: "mdTlrno", label: "录入操作员",width: 180},
        { prop: "mdTime", label: "录入时间",type: "date"},
      ],

      tableBindColumns06804: [
        { prop: "actno", label: "账户账号卡号", width: 120 },
        { prop: "acctname", label: "账户名称", width: 120 },
        { prop: "acctbrno", label: "开户银行行号", width: 120 },
        { prop: "orgname", label: "单位名称", type: "date", width: 120 },
        { prop: "protoId", label: "协议号", width: 120 },
        { prop: "idType", label: "证件类型", width: 120 },
        { prop: "idNum", label: "证件号码", width: 120 },
        { prop: "telephone", label: "电话/电挂", type: "date", width: 120 },
        { prop: "acctStatus", label: "账户状态", dictCode: "ACCT_STATUS_312", width: 120 },
        { prop: "numidResult", label: "公民身份号码校验结果", dictCode: "Vertifi_Result_Code", width: 120 },
        { prop: "telResult", label: "电话/电挂校验结果", dictCode: "Vertifi_Result_Code", width: 120 },
        { prop: "acctAttribute", label: "账户属性", dictCode: "ACCT_ATTRIBUTE_313", width: 120 },
        { prop: "amountCurcd", label: "当前余额币种", width: 120 },
        { prop: "amount", label: "当前余额", width: 120 },
        { prop: "attRemark", label: "附言", width: 120 },
      ],

      tableBindColumns06813: [
        {
          prop: "bizCtgyCode",
          label: "业务种类编码",
          formatter(row, text, index) {
            return row["bizCtgyCode"] + "-" + row["bizCtgyCodeDesc"];
          },
        },
      ],

      tableBindColumns06814: [
        { prop: "id", label: "序号", width: 120 },
        { prop: "chgType", label: "变更类型", dictCode: "CHANGECODE", width: 120 },
        { prop: "efftType", label: "生效类型", dictCode: "EFFECTIVECODE", width: 120 },
        { prop: "efftDate", label: "生效日期", type: "date", width: 120 },
        { prop: "inEffDate", label: "失效日期", type: "date", width: 120 },
        { prop: "regionid", label: "地域标识", dictCode: "RegionId", width: 120 },
        { prop: "acsOrgId", label: "入网机构标识号", width: 180 },
      ],

      tableBindColumns06815: [
        { prop: "id", label: "序号", width: 120 },
        { prop: "chgType", label: "变更类型", dictCode: "CHANGECODE", width: 120 },
        { prop: "efftType", label: "生效类型", dictCode: "EFFECTIVECODE", width: 120 },
        { prop: "efftDate", label: "生效日期", type: "date", width: 120 },
        { prop: "inEfftDate", label: "失效日期", type: "date", width: 120 },
        { prop: "regionid", label: "地域标识", dictCode: "RegionId", width: 120 },
        { prop: "acsOrgId", label: "入网机构标识号", width: 180 },
      ],

      dictMapAsync: {},
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,

      openDetail: false,
      // 表单参数
      detailForm: {
        id: 123,
      },
      totalRecord: 0,
      totalPage: 0,
      needCount: 0,
      rules: {
      },
    };
  },
  mounted() {
    const formOptions = [
      // 普通搜索
      {
        type: "input",
        prop: "idSeqNo",
        defaultAttr: {
          size: "small",
          label: "交易流水号",
          placeholder: "请输入交易流水号",
        },
      },

      {
        type: "dates",
        nameObj: {
          startTimeName: "workdate1",
          endTimeName: "workdate2",
        },
        defaultAttr: {
          size: "small",
          label: "CPG日期",
          placeholder: ["请输入CPG开始日期", "请输入CPG结束日期"],
          format: "yyyy-MM-dd",
          valueFormat: "yyyyMMdd",
        },
      },

      {
        type: "dict",
        dict: "PKG_310_312",
        prop: "mestype",
        defaultAttr: {
          size: "small",
          label: "报文类型",
          placeholder: "请输入报文类型",
        },
      },
    ];
    this.formOptions = formOptions;
    this.dictMapAsync = this.getDictMap();
  },
  methods: {
    /***
     * 按钮操作汇总
     */
    /***
     * 按钮操作汇总
     */
    /** 搜索按钮操作 */

    handleAction(type, row = {}) {
      switch (type) {
        case "detail":
          this.handleDetail(row);
          break;
        case "detail06804":
          this.handleDetail06814(row);
          break;
      }
    },

    // 关闭按钮
    cancel() {
      this.open = false;
    },

    /** 详情按钮操作 */
    handleDetail(row) {
      this.title = "通用信息应答审核明细";
      generalInformationRepsdAppDetail(row).then((response) => {
        this.detailForm = response.result;
        this.$set(this.detailForm,"oriId",this.detailForm.id1)
        this.$set(this.queryDetailParams, "id", this.detailForm.id);
        this.open = true;
      });
    },

    handleDetail06814(row) {
      generalInformationQueryDetail14(row).then((response) => {
        this.$refs.generalInformationQueryDetail.show06814(response.result);
      });
    },

    handleDetail06815(row) {
      generalInformationQueryDetail15(row).then((response) => {
        this.$refs.generalInformationQueryDetail.show06815(response.result);
      });
    },

    handleDetail068141(row) {
      generalInformationQueryDetail141(row).then((response) => {
        this.$refs.generalInformationQueryDetail.show068141(response.result);
      });
    },

    handleDetail068151(row) {
      generalInformationQueryDetail151(row).then((response) => {
        this.$refs.generalInformationQueryDetail.show068151(response.result);
      });
    },


    openBasedataDialog(dataType = "") {
      this.$refs.basedataDialog.show(dataType);
    },

    confirmData(fromFlag, row) {
      this.$set(this.detailForm, "bizRejectCode", row.dataValue);
      this.$set(this.detailForm, "bizRejectCodeDesc", row.dataDesc);
    },

    //回车获取basedata值
    getbase(dataType) {
      const dataValue = this.detailForm.bizRejectCode;
      getBasedata(dataType, dataValue)
        .then((response) => {
          if (response.code == "S" && response.result !== null) {
            this.$set(this.detailForm, "bizRejectCode", response.result.dataValue);
            this.$set(this.detailForm, "bizRejectCodeDesc", response.result.dataDesc);
          } else {
            this.msgSuccess("找不到对应的字典项");
            this.$set(this.detailForm, "bizRejectCodeDesc", null);
          }
        })
        .catch((err) => {
          this.$set(this.detailForm, "bizRejectCodeDesc", null);
        });
    },

    //下载按钮
    downloadFile(fileId,fileName) {
      if (fileId !== undefined && fileId !== "") {
        downloadfile(`${baseUrlConfig.downloadFile}`, fileId).then((response) => {
          let type = fileName.split(".")[1];
          let blob = new Blob([response.data], {type: type});
          let objectUrl = URL.createObjectURL(blob);
          const link = document.createElement("a"); // 创建a标签
          link.href = objectUrl;
          // const fileNameSplit = response.headers['content-disposition'].split('=')
          // const fileName = decodeURI(fileNameSplit[fileNameSplit.length - 1]) // 跟后端约定好最后一个值为fileName字段
          link.download = fileName; // 自定义文件名

          link.click(); // 下载文件
          URL.revokeObjectURL(objectUrl); // 释放内存
        });
      } else {
        this.msgError("下载文件不存在");
      }
    },


    //审核通过按钮
    approve(){
      this.$refs["detailForm"].validate(valid => {
        if (valid) {
          generalInformationApproveApprove(this.detailForm).then(response => {
            this.msgSuccess("审核通过");
            this.open = false;
          })

        }
      })
    },
    //审核拒绝按钮
    reject(){
      this.$refs["detailForm"].validate(valid => {
        if (valid) {
          generalInformationApproveReject(this.detailForm).then(response => {
            this.msgSuccess("审核拒绝");
            this.open = false;
          })
        }
      })
    },
  },
};
</script>
<style>
.label-header-msg {
  font-weight: bold;
}

.form-card {
  margin-bottom: 10px;
}
</style>
